#pragma once

#include "DuiLib\UIlib.h"
#include "VPlayer.h"
#include "AlphaMarkWnd.h"
#include "NetSdk\H264Play.h"
#include "MyMenuWnd.h"
#include "ColdEyesDlg.h"
#include "File\Record.h"

#include <list>
#include <vector>

#define PLAY_FPS	25

#define VPLAY_Y		40		
#define PLAYWALL_Y	120


//class CPlayerWallWnd;
class CAlphaMarkWnd;
class CMyMenuWnd;

using namespace std;

using namespace DuiLib;

enum PlayStatus
{
	stop = 0,
	playing_forward,
	pause,
	playing_back
};


class CPlayerWallWnd :
	public WindowImplBase{

public:
	CPlayerWallWnd();
	CPlayerWallWnd(CDuiString);
	~CPlayerWallWnd();
	virtual LPCTSTR GetWindowClassName() const;
	virtual CDuiString GetSkinFile();
	LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	void InitWindow();
	LRESULT CPlayerWallWnd::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
	virtual LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

	void InitPlayer();
	CRecord* SearchNextFile();

	void ClosePlayer();
	BOOL StopPlay();

	void OnBack();
	void OnFast();
	void OnPlay();
	void SetMenuWnd(CMyMenuWnd* pWnd);
	void InitPlayBtImage();


	void LoadSpanRecord(CRecord* );
	CRecord* FetchNextSpanRecord(CRecord*);
	char* FetchNextFile();

	void SetPlayRate();

	void GetPlayFileTime(CString& time);

private:


	CDuiString mSkinFileName;

	CString	mVideoShowTime;

	CVPlayer* pVPlayerWnd;
	CAlphaMarkWnd* pMarkWnd;
	CAlphaMarkWnd* pAlphaTime;

	long mPort;
	PlayStatus mStatus;
	UINT8 mFastMultiple;
	UINT8 mBackMultiple;
	DWORD thePlayTime;
	DWORD totalPlayTime;

	// pItem 
	CTextUI*	pTime;
	CButtonUI* pBack;
	CButtonUI* pPlay;
	CButtonUI* pFast;
	CLabelUI* pBeginTime;
	CLabelUI* pEndTime;
	CSliderUI* pSlider;

	LPCTSTR sPlayFocusedImg;
	LPCTSTR sPlayNoFocusImg;
	LPCTSTR sStopFocusedImg;
	LPCTSTR sStopNoFocusImg;

	std::list<CRecord*>* pListInfo ;
	std::list<CRecord*>  mPlayList;

	
	

public:
	static CPlayerWallWnd* PlayVideo(HWND hParent, LPCTSTR sSkinType, LPARAM lParam, WPARAM wParam) ;

};